#!/bin/bash
### BEGIN INIT INFO
# Provides:          ups_main_ship_shutdown
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description:  ups_main_ship service
# Description:        ups_main_ship service
### END INIT INFO

filepath="/opt/ups_main_ship/"

start(){
    cd $filepath
    nohup ./main_ship >/dev/null 2>&1 &
    echo 'start ups_main_ship service OK'
}


stop(){
    kill -9 $(pidof main_ship)
    echo 'ups_main_ship stop OK'
}


restart(){
    stop
    echo 'ups_main_ship stop stop OK'
    start
    echo 'restart ups_main_ship service OK'
}


case $1 in
    start)
       start
    ;;
    stop)
       stop
    ;;
    restart)
       restart
    ;;
    *)
       start
esac
